

#include <iostream>

using namespace std;

class Singleton;

Singleton* gInstance;


class Singleton {
public :
	static Singleton* getgInstance()
	{
		if(NULL == gInstance)
		{
			gInstance = new Singleton();			
		}
		return gInstance;			
	}

	Singleton()
	{
		cout << "Singleton()" <<endl;
	}

	void printInfo(){cout << "This is Singleton" <<endl;}
	
};



int main ()
{
	Singleton *s = Singleton::getgInstance();
	s->printInfo();

	Singleton *s1 = Singleton::getgInstance();
	s1->printInfo();

	Singleton *s2 = Singleton::getgInstance();
	s2->printInfo();

	return 0;
}






